/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upc.clase.demo.service.impl;

import edu.upc.clase.demo.dao.ReservaSalaDao;
import edu.upc.clase.demo.dao.UsuarioDao;
import edu.upc.clase.demo.dao.impl.ReservaSalaDaoImpl;
import edu.upc.clase.demo.dao.impl.UsuarioDaoImpl;
import edu.upc.clase.demo.entity.ReservaSala;
import edu.upc.clase.demo.service.ReservaSalaService;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 *
 * @author usuario
 */
@Service
public class ReservaSalaServiceImpl implements ReservaSalaService{

    private static Logger log = LoggerFactory.getLogger(ReservaSalaDaoImpl.class);    
    
    @Autowired
    private ReservaSalaDao reservaSalaDao;
    
    @Override
    public Integer insertar(ReservaSala reservaSala) {
       if (reservaSala.getCodSala().length() > 4) {
            log.info("Creando reserva");
            return reservaSalaDao.insertar(reservaSalaDao);
        }       
        return null;
    }

    @Override
    public void actualizar(ReservaSala reservaSala) {
        log.info("Actualizando reserva");
        reservaSalaDao.actualizar(reservaSala);
    }

    @Override
    public void eliminar(ReservaSala reservaSala) {
       log.info("Eliminando reserva");
       reservaSalaDao.eliminar(reservaSala);
    }

    @Override
    public List<ReservaSala> buscarTodos() {
     log.info("Buscando todas las reserva");
     return reservaSalaDao.buscarTodos();
    }

    @Override
    public ReservaSala buscar(String fecha) {
        return reservaSalaDao.buscar(fecha);
    }
    
}
